package com.timebank.timecoin.service;

import com.timebank.common.core.constant.SecurityConstants;
import com.timebank.common.core.constant.ServiceNameConstants;
import com.timebank.common.core.web.pojo.AjaxResult;
import com.timebank.timecoin.factory.RemoteContractFallBackFactory;
import com.timebank.timecoin.factory.RemoteTimeCoinFallBackFactory;
import com.timebank.timecoin.pojo.entity.User;
import io.swagger.annotations.Api;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;

/**
 * 智能合约 服务
 * @author shiliuyinzhen
 */
@FeignClient(contextId = "remoteContractService", value = ServiceNameConstants.TIMECOIN_SERVICE, fallbackFactory = RemoteContractFallBackFactory.class)
@Api(tags = "智能合约服务")
public interface RemoteContractService {

    /**
     * 修改智能合约用户信息
     * @param user
     * @param source
     * @return
     */
    @PutMapping("/contract")
    public AjaxResult updateContractUser(@RequestBody User user, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    /**
     * 添加智能合约用户
     * @param user
     * @param source
     * @return
     */
    @PostMapping("/contract")
    public AjaxResult createContractUser(@RequestBody User user, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

}
